package com.sgb.kjwl.view.ui.adapter;

import android.content.Context;
import android.view.View;
import android.widget.ImageView;
import android.widget.TextView;

import com.sgb.kjwl.BR;
import com.sgb.kjwl.R;
import com.sgb.kjwl.model.entity.supplier3.DictEntity3;
import com.swgk.core.recyclerview.adapter.BaseRecycleAdapter;
import com.swgk.core.recyclerview.adapter.ItemViewHolder;

import java.util.List;

public class DictAdapter6 extends BaseRecycleAdapter<DictEntity3> {

    private TextView nameView;
    private ImageView checkView;

    public DictAdapter6(Context context, List<DictEntity3> datas) {
        super(context, R.layout.item_dict6, datas);
    }

    @Override
    public void convert(ItemViewHolder holder, final DictEntity3 entity) {
        holder.setBinding(BR.viewModel, entity);
        nameView = holder.getItem().findViewById(R.id.name_view);
        checkView = holder.getItem().findViewById(R.id.check_view);
        if (entity.isChecked()) {
            nameView.setSelected(true);
            checkView.setVisibility(View.VISIBLE);
        } else {
            nameView.setSelected(false);
            checkView.setVisibility(View.GONE);
        }
    }

}
